/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
function disableElement( id, form_id, set ) {
	if( document.getElementById && id ) {
		var button = document.getElementById( id );
		if( button ) {
			button.setAttribute( "disabled", true );
			if( set ) {
				var hidden = document.getElementById( set );
				if( hidden ) {
					hidden.setAttribute( "value", id );
				}
			}
			if( form_id ) {
				var form = document.getElementById( form_id );
				if( form ) {
					form.submit();
				}
			}
		}
	}
}

var tooltips;
function initializeTooltips() {
	var links = YAHOO.util.Dom.getElementsByClassName( 'make-yui-tooltip', 'a' );
    tooltips = new Array();
    for( i = 0; i < links.length; i ++ ) {
        if( links[i].title && links[i].title != "" ) {
            links[i].id = YAHOO.util.Dom.generateId();
            tooltips[i] = new YAHOO.widget.Tooltip( "links[" + i + "]", { context: links[i].id, autodismissdelay: 999999, showDelay: 500, preventoverlap: true });
        }
        else if( links[i].alt && links[i].alt != "" ) {
            links[i].id = YAHOO.util.Dom.generateId();
            tooltips[i] = new YAHOO.widget.Tooltip( "links[" + i + "]", { context: links[i].id, autodismissdelay: 999999, showDelay: 500, preventoverlap: true } );
        }
    }	
}